package 高考志愿模拟系统;
public class Volunteer {
    private University university;

    public Volunteer(University university) {
        if (university == null) {
            throw new IllegalArgumentException("University cannot be null");
        }
        this.university = university;
    }

    @Override
    public String toString() {
        if (university == null) {
            return "Unknown University";
        }
        return university.getName() + " - " + String.join(", ", university.getMajors().stream().map(Major::toString).toArray(String[]::new));
    }
}